#include <stdio.h>
#include "sm4.h"

int main()
{
    char* key = "1234567891234567";
    sm4_context ctx;
    sm4_setkey_enc(&ctx, key);
    char* plain = "abcdefghijklmnop";
    char buf[17] = {0};
    sm4_crypt_ecb(&ctx, SM4_ENCRYPT, 16,plain,buf);
    int i=0;
    for(;i<16;++i)
        printf("%c", buf[i]);

    printf("\n");
    sm4_setkey_dec(&ctx, key);
    char buf2[17] = {0};
    sm4_crypt_ecb(&ctx, SM4_DECRYPT, 16, buf, buf2);
    printf("%s\n",buf2);
    return 0;
}
